<% layout('/layout/default.html', {title: '文件夹管理', libs: ['dataGrid']}){ %>
<div class="main-content">
		<div class="card-header">
			<i class="fa fa-sitemap"></i> 文件夹管理
			<div class="header-tools float-right">
				<a href="#" class="btn btn-default btn-sm " id="btnSearch" title="查询"><i class="fas fa-filter"></i> 查询</a>
				<a href="#" class="btn btn-default btn-sm "  id="btnRefreshTree" title="刷新"><i class="fas fa-redo-alt"></i> 刷新</a>
				<a href="#" class="btn btn-default btn-sm " id="btnExpandTreeNode" title="展开全部"><i class="fas fa-angle-double-down"></i> 展开</a>
				<a href="#" class="btn btn-default btn-sm " id="btnCollapseTreeNode" title="折叠全部"><i class="fas fa-angle-double-up"></i> 折叠</a>
				<% if(hasPermi('filetree:sysFileTree:edit')){ %>
					<a href="/filetree/sysFileTree/form" class="btn btn-default btn-sm btnTool" title="添加根文件夹"><i class="fas fa-plus"></i> 添加根文件夹</a>
				<% } %>
			</div>
		</div>
		<div class="container-fluid">
			<form id="searchForm" action="${ctx}/filetree/sysFileTree/listData" class="form-inline d-none">
				<div class="form-group">
					<label class="control-label">名称：</label>
					<div class="control-inline">
						<input name="name" maxlength="64" class="form-control  form-control-sm"/>
					</div>
				</div>
				<div class="form-group">
					<button type="submit" class="btn btn-sm btn-success ">查询</button>
					<button id="reset" type="reset" class="btn btn-default btn-sm ">重置</button>
				</div>
			</form>			
			<table id="dataGrid"></table>
		</div>
</div>
<% } %>
<script>

	$('#dataGrid').dataGrid({
		searchForm: $("#searchForm"),
		columnModel: [
			{header:'名称', name:'name', index:'a.name', width:150, align:"left"},
			{header:'更新时间', name:'updateDate', index:'a.update_date', width:80, align:"center",formatter:"date"},
			{header:'备注', name:'remarks', index:'a.remarks', width:80, align:"center"},
			{header:'操作', name:'actions', width:70,align:"center", sortable:false, title:false, formatter: function(val, obj, row, act){
					var actions = [];
				<% if(hasPermi('filetree:sysFileTree:edit')){ %>
						actions.push('<a href="/filetree/sysFileTree/form?id='+row.id+'" class="btnList" title="修改"><i class="fas fa-pencil-alt"></i></a>&nbsp;&nbsp;');
						actions.push('<a href="${ctx}s/filetree/sysFileTree/delete?id='+row.id+'" class="btnList" title="删除" data-confirm="确认要删除该文件夹吗?"><i class="far fa-trash-alt"></i></a>&nbsp;&nbsp;');
						actions.push('<a href="/filetree/sysFileTree/add?parentId='+row.id+'&parentName='+row.name+'" class="btnList" title="新增文件夹"><i class="fa fa-plus-square"></i></a>&nbsp;&nbsp;');
						actions.push('<a href="/filetree/sysFileTree/move?id='+row.id+'" class="btnList" title="移动文件夹"><i class="fas fa-share"></i></a>&nbsp;');
					<% } %>
					return actions.join('');
				}}
		],
		treeGrid: true,
		defaultExpandLevel: 0,
		expandNodeClearPostData: 'name',
		// 加载成功后执行事件
		ajaxSuccess: function(data){

		}
	});
</script>
